package tcu.ead2021.watermanage.entity;

import lombok.Data;

@Data
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> Result<T> ok(T data) {
        Result<T> result = new Result<>();
        result.setCode(0);
        result.setMsg("OK");
        result.setData(data);
        return result;
    }

    public static Result<String> failed(String msg) {
        Result<String> result = new Result<>();
        result.setCode(-1);
        result.setMsg(msg);
        return result;
    }
}
